<?php
class Application_Model_Commit
{
	protected $_blogId;
	protected $_parentId;
	protected $_content;
	protected $_from;
	protected $_createDt;
	protected $_id;
	
	public function __construct(array $options = null)
	{
		if (is_array($options)) {
			$this->setOptions($options);
		}
	}
	
	public function __set($name, $value)
	{
		$method = 'set' . $name;
		if (('mapper' == $name) || !method_exists($this, $method)) {
			throw new Exception('Invalid blog property');
		}
		$this->$method($value);
	}
	
	public function __get($name)
	{
		$method = 'get' . $name;
		if (('mapper' == $name) || !method_exists($this, $method)) {
			throw new Exception('Invalid blog property');
		}
		return $this->$method();
	}

	public function setOptions(array $options)
	{
		$methods = get_class_methods($this);
		foreach ($options as $key => $value) {
			$method = 'set' . ucfirst($key);
			if (in_array($method, $methods)) {
				$this->$method($value);
			}
		}
		return $this;
	}
	
	public function setBlogId($id)
	{
		$this->_blogId = (int) $id;
		return $this;
	}
	
	public function getBlogId()
	{	
		return $this->_blogId;
	}
	
	public function setParentId($id)
	{
		$this->_parentId = (string) $id;
		return $this;
	}
	
	public function getParentId()
	{
		return $this->_parentId;
	}
	
	public function setContent($content)
	{
		$this->_content = (string) $content;
		return $this;
	}
	
	public function getContent()
	{
		return $this->_content;
	}
	
	public function setFrom($from)
	{
		$this->_from = (string) $from;
		return $this;
	}
	
	public function getFrom()
	{
		return $this->_from;
	}
	
	public function setCreateDt($ts)
	{
		$this->_createDt = $ts;
		return $this;
	}

	public function getCreateDt()
	{
		return $this->_createDt;
	}

	public function setId($id)
	{
		$this->_id = (int) $id;
		return $this;
	}

	public function getId()
	{
		return $this->_id;
	}
}

